package Test2;

import java.util.Scanner;

//写测试类，对计算器类Calculator的各种算术运算功能进行测试。
public class CalculatorTest {
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Calculator calculator = new Calculator();
		
		System.out.println("请输入两个数");
		System.out.print("a:");
		double a=scanner.nextDouble();
		System.out.print("b:");
		double b=scanner.nextDouble();
		System.out.println("两数之和为："+(a+"+"+b)+"="+calculator.add(a, b));
		System.out.println("两数之差为："+(a+"-"+b)+"="+calculator.subtract(a, b));
		System.out.println("两数之积为："+(a+"x"+b)+"="+calculator.mutiply(a, b));
		System.out.println("两数之商为："+(a+"÷"+b)+"="+calculator.divide(a, b));
		System.out.println("两数取模为："+(a+"%"+b)+"="+calculator.mo(a, b));
		
		System.out.println("请输入两个数，求两数的幂运算");
		System.out.print("c:");
		double c=scanner.nextDouble();
		System.out.print("d:");
		double d=scanner.nextDouble();
		System.out.println((c+"^"+d)+"="+calculator.pow(c, d));
		
	}
}
